cmake_minimum_required(VERSION 3.10)
project(redis_demo)

# 设置C++标准
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# 查找hiredis库
find_package(PkgConfig REQUIRED)
pkg_check_modules(HIREDIS REQUIRED hiredis)

# 查找MySQL库
pkg_check_modules(MYSQL REQUIRED mysqlclient)

# 添加可执行文件
add_executable(redis_demo redis_demo1.cpp)

# 链接hiredis和MySQL库
target_link_libraries(redis_demo ${HIREDIS_LIBRARIES} ${MYSQL_LIBRARIES})
target_include_directories(redis_demo PRIVATE ${HIREDIS_INCLUDE_DIRS} ${MYSQL_INCLUDE_DIRS}) 